<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="AlbumDataSet" targetNamespace="http://tempuri.org/AlbumDataSet.xsd" xmlns:mstns="http://tempuri.org/AlbumDataSet.xsd" xmlns="http://tempuri.org/AlbumDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="1" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="SocialNetworkConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="SocialNetworkConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.WLQuickApps.SocialNetwork.Data.Properties.Settings.GlobalReference.Default.SocialNetworkConnectionString" Provider="System.Data.SqlClient" />
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="AlbumTableAdapter" GeneratorDataComponentClassName="AlbumTableAdapter" Name="Album" UserDataComponentName="AlbumTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="SocialNetwork.dbo.Album" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
                <DeleteCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>DELETE FROM [Album] WHERE (([BaseItemID] = @Original_BaseItemID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_BaseItemID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Original" />
                    </Parameters>
                  </DbCommand>
                </DeleteCommand>
                <InsertCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>INSERT INTO [Album] DEFAULT VALUES;
SELECT BaseItemID FROM Album WHERE (BaseItemID = SCOPE_IDENTITY())</CommandText>
                    <Parameters />
                  </DbCommand>
                </InsertCommand>
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT        BaseItemID
FROM            Album</CommandText>
                    <Parameters />
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="BaseItemID" DataSetColumn="BaseItemID" />
            </Mappings>
            <Sources>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="SocialNetwork.dbo.aspnet_Album_RemoveOrphanURL" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorSourceName="ClearOrphanURL" Modifier="Public" Name="ClearOrphanURL" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="ClearOrphanURL">
                <SelectCommand>
                  <DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
                    <CommandText>dbo.aspnet_Album_RemoveOrphanURL</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@AlbumID" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="SocialNetwork.dbo.aspnet_Album_RemoveOrphanURLEx" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorGetMethodName="GetDataBy5" GeneratorSourceName="ClearOrphanURLEx" Modifier="Public" Name="ClearOrphanURLEx" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy1" UserSourceName="ClearOrphanURLEx">
                <SelectCommand>
                  <DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
                    <CommandText>dbo.aspnet_Album_RemoveOrphanURLEx</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="CreateAlbum" Modifier="Public" Name="CreateAlbum" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy2" UserSourceName="CreateAlbum">
                <InsertCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>INSERT INTO Album
                         (BaseItemID)
VALUES        (@baseItemID)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.Album" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </InsertCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="DeleteAlbum" Modifier="Public" Name="DeleteAlbum" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy3" UserSourceName="DeleteAlbum">
                <DeleteCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>DELETE FROM Album
WHERE        (BaseItemID = @baseItemID)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.Album" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Original" />
                    </Parameters>
                  </DbCommand>
                </DeleteCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="SocialNetwork.dbo.Album" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="GetAlbum" GeneratorSourceName="FillByAlbumID" GetMethodModifier="Public" GetMethodName="GetAlbum" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetAlbum" UserSourceName="GetAlbum">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT BaseItemID FROM Album WHERE (BaseItemID = @baseItemID)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.Album" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="GetAlbumsByBaseItemID" GeneratorSourceName="FillBy" GetMethodModifier="Public" GetMethodName="GetAlbumsByBaseItemID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetAlbumsByBaseItemID" UserSourceName="GetAlbumsByBaseItemID">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>WITH PageTable AS
(
SELECT        Album.BaseItemID

		, ROW_NUMBER() over (order by Album.BaseItemID) as RowID

FROM            Album INNER JOIN
                         BaseItemAssociation ON Album.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE        (BaseItemAssociation.BaseItemID = @baseItemID)

)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="GetAlbumsByBaseItemIDCount" Modifier="Public" Name="GetAlbumsByBaseItemIDCount" QueryType="Scalar" ScalarCallRetval="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy4" UserSourceName="GetAlbumsByBaseItemIDCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT COUNT(*) 
FROM            Album INNER JOIN
                         BaseItemAssociation ON Album.BaseItemID = BaseItemAssociation.AssociatedBaseItemID
WHERE        (BaseItemAssociation.BaseItemID = @baseItemID)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="baseItemID" ColumnName="BaseItemID" DataSourceName="SocialNetwork.dbo.BaseItemAssociation" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@baseItemID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="BaseItemID" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="GetAlbumsByUserID" GeneratorSourceName="FillAllAlbumsByUserID" GetMethodModifier="Public" GetMethodName="GetAlbumsByUserID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetAlbumsByUserID" UserSourceName="GetAlbumsByUserID">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>WITH PageTable AS
(
SELECT        Album.BaseItemID
		, ROW_NUMBER() over (order by Album.BaseItemID) as RowID

FROM            Album inner join BaseItem on BaseItem.BaseItemID = Album.BaseItemID
Where BaseItem.OwnerUserID = @ownerUserID
)

select * from PageTable
where RowID between (@startRowIndex + 1) and (@startRowIndex + @maximumRows)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="creatorUserID" ColumnName="CreatorUserID" DataSourceName="" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@ownerUserID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="CreatorUserID" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@startRowIndex" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@maximumRows" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="SocialNetworkConnectionString (Settings)" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="GetAlbumsByUserIDCount" Modifier="Public" Name="GetAlbumsByUserIDCount" QueryType="Scalar" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy5" UserSourceName="GetAlbumsByUserIDCount">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT COUNT(*) FROM BaseItem Where OwnerUserID = @ownerUserID and ItemType = 'Album'</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="ownerUserID" ColumnName="OwnerUserID" DataSourceName="SocialNetwork.dbo.BaseItem" DataTypeServer="uniqueidentifier" DbType="Guid" Direction="Input" ParameterName="@ownerUserID" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="OwnerUserID" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="AlbumDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="AlbumDataSet" msprop:Generator_DataSetName="AlbumDataSet">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Album" msprop:Generator_UserTableName="Album" msprop:Generator_RowDeletedName="AlbumRowDeleted" msprop:Generator_RowChangedName="AlbumRowChanged" msprop:Generator_RowClassName="AlbumRow" msprop:Generator_RowChangingName="AlbumRowChanging" msprop:Generator_RowEvArgName="AlbumRowChangeEvent" msprop:Generator_RowEvHandlerName="AlbumRowChangeEventHandler" msprop:Generator_TableClassName="AlbumDataTable" msprop:Generator_TableVarName="tableAlbum" msprop:Generator_RowDeletingName="AlbumRowDeleting" msprop:Generator_TablePropName="Album">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="BaseItemID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="BaseItemID" msprop:Generator_ColumnVarNameInTable="columnBaseItemID" msprop:Generator_ColumnPropNameInRow="BaseItemID" msprop:Generator_ColumnPropNameInTable="BaseItemIDColumn" type="xs:int" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:Album" />
      <xs:field xpath="mstns:BaseItemID" />
    </xs:unique>
  </xs:element>
</xs:schema>